-
Notifications
You must be signed in to change notification settings - Fork 132
feat(chat): implement file upload ingestion support #905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
- Add to to support handling file uploads - Add endpoint to - Add method to TypeScript - Add file upload button to component - Add example - Add unit tests for upload functionality
Code Coverage SummaryDetailsDiff against mainResults for commit: de7aa84 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
typescript/ui/src/core/components/inputs/PromptInput/PromptInput.tsx
Outdated
Show resolved
Hide resolved
| if (body instanceof FormData) { | ||
| requestOptions.body = body | ||
| // Let the browser set the Content-Type header with the boundary | ||
| if ( | ||
| requestOptions.headers && | ||
| 'Content-Type' in requestOptions.headers | ||
| ) { | ||
| delete (requestOptions.headers as Record<string, string>)[ | ||
| 'Content-Type' | ||
| ] | ||
| } | ||
| } else { | ||
| requestOptions.body = | ||
| typeof body === 'string' ? body : JSON.stringify(body) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've performed some tests and the current implementation doesn't seem to work. We are passing empty requestOptions.headers object to the _makeRequest method, which applies default headers. The default headers aren't overridden because requestOptions.headers field doesn't contain any Content-Type definition.
I think we should set default headers in the _makeRequest conditionally. Something like:
const defaultHeaders: Record<string, string> =
typeof options.body === 'string' // we guess that it's JSON
? {
'Content-Type': 'application/json',
}
: {}and also keep this part here.
upload_handlertoChatInterfaceto support handling file uploads/api/uploadendpoint toRagbitsAPIuploadFilemethod to TypeScriptRagbitsClientPromptInputcomponentexamples/chat/upload_chat.py